#include"RBTree.h"

template<class K,class V>
class MyMap
{
public:
	struct MapKOfT
	{
		const K& operator()(const pair<K, V>& kv)
		{
			return kv.first;
		}
	};

	typedef typename RBTree<K, pair<K, V>, MapKOfT>::iterator iterator;

	iterator begin()
	{
		return _tree.begin();
	}

	iterator end()
	{
		return _tree.end();
	}

	bool insert(const pair<K, V>& kv)
	{
		return _tree.Insert(kv);
	}

private:
	RBTree<K, pair<K, V>, MapKOfT> _tree;
};

int main()
{
	MyMap<int, int> m;
	int a[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
	for (auto e : a)
	{
		m.insert(make_pair(e, e));
	}

	MyMap<int, int>::iterator it = m.begin();

	return 0;
}